<?php

namespace App\Service;

use App\Model\BookLibrary;
use App\Model\StoreGoods;

class GoodsService
{
    /**
     * 获取商品详情
     * @param $goodsId
     * @param $storeId
     * @return mixed
     */
    public function getGoodsDetail($goodsId, $storeId)
    {
        //判断是否属于自定义商品
        $result = StoreGoods::where(['store_id' => $storeId, 'id' => $goodsId])
                    ->first(['goods_info_type', 'isbn']);
        if ($result->goods_info_type == 1) {
            $result = StoreGoods::where(['store_id' => $storeId, 'id' => $goodsId])
                ->first();
        }

        //非自定义商品时，从产品库获取
        $result = BookLibrary::where('isbn', $result->isbn)
                    ->first();
        return $result;
    }

    public function getGoodsListByCategoryId($categoryId, $storeId, $categoryType)
    {

    }

    private function systemGoodsByCateId()
}
